package role;

import student.Student;

/*
 * ==UML
 * Methoden fertig
 */
/**
 * 
 * @author Gero Kraus
 * 
 */
public class Role
{
	private String name, comment;
	private Student student;

	/**
	 * Erzeugt eine Standard-Rolle
	 * 
	 */
	public Role()
	{
		this.name = "Teilnehmer";
		this.comment = null;
		this.student = null;
	}


	public Role(String name)
	{
		this.name = name;
		this.comment = null;
		this.student = null;
	}

	public Role(String name, String comment)
	{
		this.name = name;
		this.comment = comment;
		this.student = null;
	}

	public boolean hasStudent()
	{
		if (this.student != null)
			return true;
		else
			return false;
	}

	public void setStudent(Student student)
	{
		this.student = student;
	}

	public Student getStudent()
	{
		return student;
	}

	public void removeStudent()
	{
		this.student = null;
	}

	public void setStandard()
	{
		this.name = null;
		this.comment = null;
	}

	public String getName()
	{
		return name;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	public String getComment()
	{
		return comment;
	}

	public void setComment(String comment)
	{
		this.comment = comment;
	}

	/**
	 * Vergleicht nur die Namen
	 * 
	 * @param obj
	 *            Vergleich mit diesem Objekt
	 * @return
	 */
	public boolean isSameRole(Object obj)
	{
		if (obj == null)
			return false;
		if (obj.getClass() != this.getClass())
			return false;

		Role r = (Role) obj;
		if (r.getName() != this.getName())
		{
			return false;
		}
		// Evtl Vergleich der Beschreibung
		return true;
	}

	public static Role getEmptyRole()
	{
		return new Role();
	}
}
